package com.zecan.blog.vo.chattingRecords;

import com.zecan.blog.entity.ChattingRecords;
import lombok.Builder;
import lombok.Data;

/**
 * 后台系统聊天记录Vo
 * @author zecan
 * @Description:
 * @ClassName: bgChatRecordVo
 * @date 2023/1/13 19:18
 */
@Data
@Builder
public class bgChatRecordVo {

    // 聊天记录id
    Integer recordId;

    // 聊天记录内容
    String message;

    // 当前发布聊天的用户id, 在外层存储的是当前聊天对象的用户id, 在聊天记录list中存储发送内容的用户id
    Integer userId;

    // 头像url
    String avatar;

    // 发送消息用户昵称
    String sendUsername;

    // 接受消息用户昵称
    String receiveUsername;

    // 发送时间
    String createTime;

    // 总聊天记录条数
    Integer recordCount;

    public static bgChatRecordVo bgChatRecordVo(ChattingRecords chattingRecords) {
        return bgChatRecordVo.builder()
                .recordId(chattingRecords.getRecordId())
                .userId(chattingRecords.getRecordUserId())
                .message(chattingRecords.getRecordContent())
                .avatar(chattingRecords.getAvatarUrl())
                .sendUsername(chattingRecords.getNickname())
                .receiveUsername(chattingRecords.getReceiveUsername())
                .createTime(chattingRecords.getRecordCreateTime())
                .build();
    }
}
